/**
 * Copyright 2019 Inc.
 **/
package com.myz.demo;


import feign.gson.GsonDecoder;

import java.util.List;

/**
 * 使用feign.hystrix.HystrixFeign
 * <dependency>
 * <groupId>com.netflix.feign</groupId>
 * <artifactId>feign-hystrix</artifactId>
 * <version>8.18.0</version>
 * </dependency>
 *
 * @author maoyz0621 on 19-7-11
 * @version: v1.0
 */
public class HystrixFeign {

    /**
     * 使用HystrixFeign熔断器
     *
     * @param args
     */
    public static void main(String... args) {
        GitHub github = feign.hystrix.HystrixFeign.builder()
                .decoder(new GsonDecoder())
                .target(GitHub.class, "https://api.github.com");


        List<Contributor> contributors = github.contributors("OpenFeign", "feign");
        for (Contributor contributor : contributors) {
            System.out.println(contributor.login + " (" + contributor.contributions + ")");
        }

    }
}